          SUBROUTINE (DESC,ALT.DESC,DISP.AREA)
** Version# 35.0002[4] - 11/18/2014 - 02:53pm - TSMITH - eclipse
*** V35.0002 Change - Custom Coding . - 11/18/2014 - TSMITH - eclipse
*** V35.0001 Change - Custom Coding . - 10/29/2013 - TSMITH - eclipse

*** Subroutine: OE.DESC.GET
*-------------------------------------------------------------------------*
** This reoutine determines the extended description for a given item.
** Extended description covers actual extended description of the item
** plus any of the following:
**                            > Comments for the item on the order
**                            > Alternate description
**                            > Pricing comments
**                            > MSDS Sheet information
*-------------------------------------------------------------------------*
** Parameters:
**  DESC      - Full description of item including comments,etc.     (Out)
**  ALT.DESC  - Alternate description flag                           (In)
**  DISP.AREA - Area of the system asking for display (SOE,
**              POE, TOE, etc)                                       (In)
*-------------------------------------------------------------------------*
** !!! NOTE: This routines assumes that LD and PRD are active !!!
*-------------------------------------------------------------------------*

          LOT.ORDER = (LED(83)<1,1>[1,7] = "@JOBNO=")

          *** Retrieve a list of comment types defined for this system.
          *** (Example, "General Comments" or "Replacement Description")
          IF DISP.AREA # '' THEN
             READ DISP.AREAS FROM CTRLFILE,"OE.CMT.DISP.AREAS" ELSE
                DISP.AREAS = ''
             END
          END

          REPL = NO                ;* Flag for replacement description
          IF NOT(NUM(LD(1))) THEN
             *** Comment is specific only to order
             GOSUB GET.CMTS
             DESC = CMTS
          END ELSE
             *** Comment is specific for a certain product
             IF PRD(3) = 9 THEN LOT.FLAG = YES ELSE LOT.FLAG = NO
             BEGIN CASE
             CASE ALT.DESC AND PRD(66) # ''
                DESC = '*':PRD(66)
             CASE ALT.DESC AND LOT.FLAG
                DESC = '^':RAISE(LD(3))
             CASE OTHERWISE
                DESC = PRD(1)
             END CASE

             *** Remove hard returns for Java process
            ***We can not do it here because SOE.PRINT.INVOICE
           *** relies on the VM to print the invoice correctly
           *** this should be done on client side when returned.
            ! IF JAVA.PROC$ THEN
            !    CONVERT VM TO " " IN DESC
            ! END

             *** See if comments contained in LD(3) should be displayed
             *** in this area of system.
             IF LD(3) OR LOT.ORDER THEN
                GOSUB GET.CMTS
                IF CMTS # '' THEN
                   DESC<1,-1> = CMTS
                END
             END
             OID  = LD(24)<1,1>
             *** Append return comments if system is set up to do so
             READV RET FROM CTRLFILE,'ADD.RETURN.CMT.DESC',1 ELSE RET = ''
             IF RET AND LD(46) AND OID[1,1]#'R' THEN DESC<1,-1> = LD(46)
             IF RET AND LD(45) THEN DESC<1,-1> = LD(45)

             *** Add additional sell item comments...
             TST.AREA = DISP.AREA[2,99]
             IF TST.AREA  = "OE" THEN
                IF LD(49) # '' THEN
                   ICT = DCOUNT(LD(49),VM)
                   FOR ILN = 1 TO ICT
                      NPN  = LD(49)<1,ILN>
                      PRC  = OCONV(LD(52)<1,ILN>,"MR3")
                      READV TDESC FROM PRDFILE,NPN,1 ELSE TDESC = ''
                      IF TDESC # '' THEN
                         CONVERT VM TO ' ' IN TDESC
                         DESC<1,-1> = '>':LD(50)<1,ILN>:' : ':TDESC<1>
                         DESC<1,-1> = '>**** : Priced At $':PRC "R#9"
                      END
                   NEXT ILN
                END
             END

             **** Material safty datasheet comments...
             IF LD(87) THEN
                UT.OPEN.COMMON.FILE 'MSDS.SHEETS',HNDL.NO
                IF HNDL.NO > 0 THEN
                   MSDSFILE = FILES(HNDL.NO)
                   MSDS.ID  = FIELD(LD(87),'~',2)
                   READV SHEET.NO FROM MSDSFILE,MSDS.ID,1 THEN
                      DESC<1,-1> = 'MSDS Sheet# ':SHEET.NO:' Required'
                   END
                END
             END
          END

          RETURN
*-------------------------------------------------------------------------*
*** Certian comment types can only be viewed in certian parts of the system
*** This routine will filter out all comments that are not viewable from
*** the area of the system user is currently in.
GET.CMTS:

          CMTS = ''

          *** If this is a subtotal, then the "comment" for the subtotal
          *** is strictly stored in LD(3) and we need not look at LD(2).
          *** Otherwise, we'll have to check the comment type.
          BEGIN CASE

          * Get Job Managment Comments
          CASE LOT.ORDER
             OID  = LD(24)<1,1>
             LDID = LD(24)<1,2>
             CMTS = JOBMGMT.GET.CMT(OID,LDID)
             * Append any additional comments.
             IF LD(3) # '' THEN
                IF CMTS # '' THEN
                   CMTS := VM:RAISE(LD(3))
                END ELSE
                   CMTS = RAISE(LD(3))
                END
             END

          * Get Sub Total Comments
          CASE LD(1)  = 'S'
             CMTS   = LD(3)

          * Everything else
          CASE OTHERWISE
             READ CMT.INFO FROM CTRLFILE,'OE.COMMENT.TYPES' ELSE
                CMT.INFO = ''
             END
             CMT.CT    = DCOUNT(LD(2)<1>,VM)
             IF CMT.CT < 1 AND LD(3)<1,1> # '' THEN CMT.CT = 1

             FOR CLN = 1 TO CMT.CT
                GOSUB FIND.CMTS
             NEXT CLN

          END CASE

          RETURN
*-------------------------------------------------------------------------*
*** Set up CMTS based upon control record setting
FIND.CMTS:
          CMT.TYPE = LD(2)<1,CLN>
          LOCATE CMT.TYPE IN CMT.INFO<1> SETTING CMT.POS THEN
             IF DISP.AREA # '' THEN
                LOCATE DISP.AREA IN DISP.AREAS<1> SETTING CPOS THEN
                   IF CMT.INFO<4,CMT.POS,CPOS> = '1' THEN
                      *** If comment is a replacement desc then
                      *** replace Eclipse description with comment
                      IF CMT.INFO<5,CMT.POS> = '1' AND NOT(REPL) THEN
                         DESC = '^':RAISE(LD(3)<1,CLN>)
                         REPL = YES
                      END ELSE
                         CMTS<1,-1> = CMT.INFO<6,CMT.POS>
                         CMTS<1,-1> = RAISE(LD(3)<1,CLN>)
                      END
                   END
                END
             END ELSE
                CMTS<1,-1> = CMT.INFO<6,CMT.POS>
                CMTS<1,-1> = RAISE(LD(3)<1,CLN>)
             END
          END ELSE
             CMTS<1,-1> = RAISE(LD(3)<1,CLN>)
          END

          RETURN
*-------------------------------------------------------------------------*
!TSMITH~11/18/14~14:53
